home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94b.txt
/
000062_icon-group-sender _Tue Sep 20 15:30:41 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1995-02-09
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 20 Sep 1994 15:46:32 MST
From: Nevin Liber <nevin@caslon>
Message-Id: <199409202230.PAA03229@caslon.CS.Arizona.EDU>
Subject: Re: Question: conjunction in Icon and C
To: eschen@molbio.cbs.umn.edu (Art Eschenlauer)
Date: Tue, 20 Sep 1994 15:30:41 -0700 (MST)
Cc: icon-group@cs.arizona.edu
In-Reply-To: <9409202041.AA18914@molbio.cbs.umn.edu> from "Art Eschenlauer" at Sep 20, 94 03:41:27 pm
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 1024
Errors-To: icon-group-errors@cs.arizona.edu
Art Eschenlauer proudly drove the following message along the Information SuperHypeway(TM) at breakneck speeds:
> In Icon, if I say:
> if <expr1> & <expr2> then <expr3> else <expr4>
> and <expr1> fails, <expr2> will not be evaluated.
>
> In C, if I say:
> if ( <expr1> && <expr2> ) <expr3>; else <expr4>;
> and <expr1> has a value of zero (NULL, etc.), is it defined (in the ANSI
> standard, I guess) whether <expr2> will be evaluated or is this compiler
> specific?
In C, if <expr1> has a value of 0, then <expr2> is not evaluated, and
the value of the expression ( <expr1> && <expr2> ) is 0. If <expr1>
has a non-zero (true) value, then <expr2> is evaluated, and the value
of the expression ( <expr1> && <expr2> ) is 0 if <expr2> is 0,
otherwise, the value is 1 (unlike Icon, where you might expect it to be
the same as <expr2>). This is specified in both K&R 1 as well as the
ANSI C standard.
--
Nevin ":-)" Liber nevin@cs.arizona.edu (602) 293-2799
^^^ (520) after 3/95